Method of decoding moving pictures in intra prediction

ABSTRACT

A method for encoding an image includes determining an intra prediction mode of a current block; generating a prediction block of the current block according to the intra-prediction mode; generating a residual block by calculating a difference between the current block and the prediction block; transforming the residual block to generate a transform block; quantizing the transform block to generate a quantized block; and entropy-coding coefficients of the quantized block.

CROSS-REFERENCE TO RELATED APPLICATIONS

This Application is a Continuation of U.S. patent application Ser. No.16/149,491 filed on Oct. 2, 2018 (now U.S. Pat. No. 10,735,772 issued onAug. 4, 2020), which is a Continuation of U.S. patent application Ser.No. 15/699,455 filed on Sep. 8, 2017 (now U.S. Pat. No. 10,142,658issued on Nov. 27, 2018), which is a Continuation of U.S. patentapplication Ser. No. 14/591,477 filed on Jan. 7, 2015 (now U.S. Pat. No.9,788,016 issued on Oct. 10, 2017), which is a Continuation of U.S.patent application Ser. No. 13/743,161 filed on Jan. 16, 2013 (now U.S.Pat. No. 9,445,127 issued on Sep. 13, 2016), which is a Continuation ofPCT International Application No. PCT/KR2012/001923 filed on Mar. 16,2012, which claims the priority benefit under 35 U.S.C. § 119(a) toKorean Patent Application No. 10-2011-0030294 filed in the Republic ofKorea on Apr. 1, 2011, all of which are hereby expressly incorporated byreference into the present application.

BACKGROUND OF THE INVENTION Field of the Invention

The present invention relates to a method for decoding moving picturesin intra prediction mode, and more particularly, to the method forgenerating a prediction block similar to an original image by adaptivelygenerating and filtering reference pixels of a current block.

Discussion of the Related Art

Many digital video compression techniques have been proposed toefficiently transmit a video signal at a low data rate with high videoquality. The video compression techniques include H.261, Moving PictureExperts Group-2/H.262 (MPEG-2/H.262), H.263, MPEG-4, Advanced VideoCoding/H.264 (AVC/H.264), etc. These compression techniques involveDiscrete Cosine Transform (DCT), Motion Compensation (MC), quantization,entropy coding, etc.

To keep high video quality, a large amount of data is taken for videocoding. However, an available data rate for transmitting coded data islimited because of a limited allowed bandwidth for video datatransmission. For example, a data channel of a satellite broadcastingsystem or a data channel of a digital cable TV network transmits datatypically at a Constant Bit Rate (CBR).

In this context, video coding schemes have been proposed to achieve highvideo quality, while minimizing implementation complexity and atransmission data rate.

For example, the H.264/AVC standard offers intra-prediction coding in aspatial area using adjacent pixels. Determining adjacent pixels to beused is important to improvement of coding efficiency. For this purpose,the optimum direction to be used for the intra-prediction is determinedand a predicted value of a pixel to be encoded is calculated usingadjacent pixels corresponding to the optimum direction.

However, as prediction blocks are increased diversified in size, aplurality of adjacent reference blocks are highly likely to exist for acurrent block. In this case, a difference of pixel values may begenerated between reference pixels at both boundaries of the referenceblocks. If intra-prediction is performed using the reference pixels,residual blocks obtained after the generation of prediction blocks maycontain many high-frequency components. As a consequence, codingefficiency is decreased.

SUMMARY OF THE INVENTION

An object of the present invention is to provide a method forreconstructing an intra-prediction block similar to an original image.Furthermore, the object of the present invention is to provide a methodfor reducing the amount of data and improving a video quality byminimizing the amount of data of a residual signal when a block encodedin intra-prediction mode is reconstructed.

The object of the present invention can be achieved by providing amethod for decoding moving pictures in intra prediction, the methodcomprising: reconstructing the intra-prediction mode of a current block;generating a reference pixel using an available reference pixel whenthere is an unavailable reference pixel for the current block;adaptively filtering the reference pixel of the current block based onthe reconstructed intra-prediction mode and a size of the current block;and generating a prediction block of the current block using theintra-prediction mode of the current block and reference pixelcorresponding to the intra-prediction mode, wherein, in the generatingstep of the reference pixel, the unavailable reference pixel is set as apixel value of the available reference pixel, the available referencepixel being an available pixel on the nearest position in apredetermined direction from the unavailable reference pixel.

And, in accordance with the present invention, when there is not theavailable reference pixel positioned in the predetermined direction fromthe unavailable reference pixel, the unavailable reference pixel is setas a pixel value of the available reference pixel on the nearestposition in the opposite direction.

Furthermore, in accordance with the present invention, as a size of acurrent block is increased, the number of the intra-prediction mode forfiltering a reference pixel may be equal to or increased.

According to the present invention, there are advantages in that aprediction block similar to an original image is obtained by generatingan unavailable reference pixel from an available reference pixel andgenerating the prediction block after the reference pixel is adaptivelyfiltered based on a size and intra-prediction mode of a current block.Furthermore, not only the compression performance of the moving picturescan be improved, but also the encoding and decoding efficiency can bemaximized, by generating a prediction block similar to an original blockand minimizing an amount of data of a residual signal.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are included to provide a furtherunderstanding of the invention, illustrate embodiments of the inventionand together with the description serve to explain the principle of theinvention.

In the drawings:

FIG. 1 is a block diagram of a video encoder according to an embodimentof the present invention;

FIG. 2 is a flowchart illustrating an operation of an intra-predictoraccording to an embodiment of the present invention;

FIG. 3 is a drawing referred to for describing planar mode predictionaccording to an embodiment of the present invention;

FIG. 4 is a block diagram of a video decoder according to an embodimentof the present invention; and

FIG. 5 is a flowchart illustrating an operation for reconstructing anintra-block according to an embodiment of the present invention.

DETAILED DESCRIPTION OF THE EMBODIMENTS

Reference will now be made in detail to embodiments of the presentinvention, examples of which are illustrated in the accompanyingdrawings. Since there can be a variety of alterations and embodiments ofthe present invention, certain embodiments will be illustrated anddescribed with reference to the accompanying drawings. This, however, isby no means to restrict the present invention to certain embodiments,and shall be construed as including all alterations, equivalents andsubstitutes covered by the spirit and scope of the present invention.

FIG. 1 is a block diagram of a video encoder according to an embodimentof the present invention.

Referring to FIG. 1, the video encoder includes a coding mode decider110, an intra-predictor 120, a motion compensator 130, a motionestimator 131, a transform encoder/quantizer 140, an entropy encoder150, a dequantizer/transform decoder 160, a deblocking filter 170, apicture storage 180, a subtractor 190, and an adder 200.

The coding mode decider 110 partitions a picture into coding blocks eachhaving a predetermined size by analyzing an input video signal anddetermines a coding mode for the coding blocks. The coding mode includesan intra-prediction coding and an inter-prediction coding.

A picture is comprised of a plurality of slices, each slice including aplurality of Largest Coding Units (LCUs). An LCU may be partitioned intoa plurality of Coding Units (CUs). An encoder may add a flag indicatingwhether it is partitioned or not to a bit stream and a decoder maydetermine the position of an LCU using an address, LcuAddr. If divisionis not allowed, a CU is considered to be a Prediction Unit (PU) and thedecoder may determine the position of a PU using a PU index.

A PU may be divided into a plurality of partitions. In addition, the PUmay include a plurality of Transform Units (TUs).

The coding mode decider 110 transmits the video data in block unit, forexample, PU or TU, each block unit having the predetermined sizeaccording to the determined coding mode, to the subtractor 190.

The transform encoder/quantizer 140 transforms a residual blockcalculated by the subtractor 190 from the spatial domain to thefrequency domain. For example, the transform encoder/quantizer 140performs two-dimensional Discrete Cosine Transform (DCT) or DiscreteSine Transform (DST) on the residual block. Further, the transformencoder/quantizer 140 determines a quantization step size and quantizestransform coefficients using the determined quantization step size. Aquantization matrix may be determined according to the determinedquantization step size and coding mode.

The quantized two-dimensional transform coefficients are transformed toone-dimensional transform coefficients by one of predetermined scanningmethods. A sequence of one-dimensional transform coefficients isprovided to the entropy encoder 150.

The dequantizer/transform decoder 160 dequantizes the quantizedcoefficients received from the transform encoder/quantizer 140 andinversely transforms the dequantized coefficients, therebyreconstructing the frequency-domain residual block to the spatial-domainresidual block.

The deblocking filter 170 performs filtering on the dequantized andinversely transformed video data received from the dequantizer/transformdecoder 160 in order to remove blocking effects.

The picture storage 180 reconstructs a video in picture unit from thefiltered video data received from the deblocking filter 170 and storesthe reconstructed video. A picture may be an image in a frame or field.The picture storage 180 includes a buffer (not shown) for storing aplurality of pictures. The plurality of pictures stored in the bufferare provided for intra-prediction and motion estimation. These picturesare referred to as reference pictures.

The motion estimator 131 receives at least one reference picture fromthe picture storage 180, performs motion estimation using the at leastone reference picture, and outputs motion data including a motionvector, an index indicating the reference picture, and block mode.

To optimize prediction accuracy, the motion vector is determined with afractional-pixel accuracy, for example, a ½ or ¼ pixel accuracy. Becausethe motion vector may be calculated to a fractional-pixel accuracy, themotion compensator 130 calculates a pixel value at a fractional pixelposition from a pixel value at an integer pixel position by applying aninterpolation filter for calculating a pixel value at a fractional pixelposition to the reference picture.

The motion compensator 130 extracts a prediction block matching to ablock to be encoded from the reference picture used for motionestimation among the plurality of reference pictures stored in thepicture storage 180, according to the motion data received from themotion estimator 131.

The motion compensator 130 determines the filter characteristics of anadaptive interpolation filter needed for factional-accuracy motioncompensation. The filter characteristics include information indicatinga filter type and filter size of the adaptive interpolation filter, etc.The filter size may be represented, for example, as the number of taps,i.e. the number of filter coefficients of the adaptive interpolationfilter.

Specifically, the motion compensator 130 may select a separable ornon-separable adaptive interpolation filter and then determine thenumber of taps for the selected adaptive interpolation filter and eachfilter coefficient. A value of the filter coefficient may be determineddifferently based on a fractional pixel position relative to an integerpixel position. In addition, the motion compensator 130 may use aplurality of non-adaptive interpolation filters with fixed filtercoefficients.

The motion compensator 130 may set the characteristics of theinterpolation filter for each predetermined processing unit such as afractional pixel, a basic coding unit (CU), a slice, a picture, or asequence. The motion compensator 130 may set one characteristic for onevideo data. Since the same filter characteristic is kept within the samepredetermined processing unit, the motion compensator 130 includes amemory for temporarily maintaining the filter characteristic. The memorypreserves a filter characteristic and a filter coefficient, when needed.For example, the motion compensator 130 may determine a filtercharacteristic for each I picture and a filter coefficient for eachslice.

The motion compensator 130 receives the reference picture from thepicture storage 180 and generates a predicted reference picture with afractional-pixel accuracy by filtering the reference picture using thedetermined adaptive interpolation filter.

Then, the motion compensator 130 generates a prediction block byperforming motion compensation with a fractional-pixel accuracy based onthe predicted reference picture and the motion vector determined by themotion estimator 131.

In case of prediction coding between pictures, the subtractor 190receives a block of the reference picture matching to an input block tobe encoded, calculates a difference between the block of the referencepicture and the input block, and outputs the difference as a residualsignal.

The intra-predictor 120 performs intra-prediction coding using thereconfigured pixel values within a prediction picture. Theintra-predictor 120 receives a current block for prediction coding,selects one of a plurality of intra-prediction modes according to a sizeof the current block, and performs intra-prediction on the current blockin the selected intra-prediction mode. The intra-predictor 120determines the intra-prediction mode for the current block usingpreviously encoded pixels adjacent to the current block and generates aprediction block corresponding to the determined mode.

A previously encoded area of the current picture is decoded and storedin the picture storage 180 for future use in the intra-predictor 120.The intra-predictor 120 generates a prediction block of the currentblock using adjacent pixels to the current block or availablenon-adjacent pixels within the previously encoded area of the currentpicture stored in the picture storage 180.

To predict an intra-block, the intra-predictor 120 may filter adjacentpixels adaptively. The video encoder may transmit information indicatingwhether filtering is performed to a video decoder so that the videodecoder may perform the same operation. Or whether filtering isperformed may be determined based on the intra-prediction mode and sizeof the current block.

A prediction type used in the video encoder depends on whether an inputblock is encoded in an intra mode or an inter mode, by the coding modedecider 110.

An intra/inter switch controls switching between the intra mode and theinter mode.

The entropy encoder 150 entropy-encodes the quantized coefficientsreceived from the transform encoder/quantizer 140 and the motioninformation generated from the motion estimator 131. In addition, theentropy encoder 150 may encode intra-prediction mode, control data(e.g., a quantization step size, etc.). The entropy encoder 150 furtherencodes filter coefficients determined by the motion compensator 130 andoutputs the coded filter coefficients in a bit stream.

FIG. 2 is a flowchart illustrating an operation of the intra-predictor120 according to an embodiment of the present invention.

Referring to FIG. 2, the intra-predictor 120 receives prediction modeinformation and size information of a prediction block from the codingmode decider 110 (S110). The prediction mode information indicates anintra mode. The prediction block may be a square of 64×64, 32×32, 16×16,8×8 or 4×4 pixels, to which the present invention is not limited. Thatis, the prediction block may be shaped into a form other than a square.

Then, the intra-predictor 120 reads a reference pixel from the picturestorage 180 in order to determine an intra-prediction mode of theprediction block. The intra-predictor 120 determines whether to generatethe reference pixel by checking whether there is an unavailablereference pixel (S120). The reference pixels are used in determining theintra-prediction mode of the current block.

If the current block is positioned at an upper boundary of the currentpicture, there are no adjacent pixels above the current block. If thecurrent block is positioned at a left boundary of the current picture,there are no adjacent pixels to the left of the current block. Thesepixels are determined as unavailable pixels. If the current block ispositioned at a boundary of a slice, adjacent pixels above or to theleft of the slice are determined as the unavailable pixels unless theyare previously encoded and reconstructed.

In the absence of left or upper adjacent pixels to the current block orin the absence of previously encoded and reconstructed pixels, theintra-prediction mode of the current block may be determined using onlythe available pixels.

On the other hand, the reference pixels positioned in an unavailablearea may be generated using the available reference pixels of thecurrent block (S130). For example, if the pixels of an upper block arenot available, the upper pixels may be generated using the whole or apart of left pixels, or vice versa. In other words, a reference pixelmay generated by copying an available pixel, the available pixelindicating a pixel nearest to the reference pixels in a predetermineddirection, the reference pixels positioned in an unavailable area.

Even though there are upper or left pixels adjacent to the currentblock, the pixels may be determined as unavailable reference pixelsdepending on the coding mode of a block including the pixels. Forexample, if the block including the upper pixels adjacent to the currentblock has been inter-coded and reconstructed, the upper pixels may bedetermined as unavailable pixels. In this case, available referencepixels may be generated using pixels of an adjacent block that has beenintra-coded and reconstructed. The video encoder should transmitinformation indicating that available reference pixels are determinedaccording to a coding mode to the video decoder.

Subsequently, the intra-prediction mode of the current block isdetermined using the reference pixels (S140). The number ofintra-prediction modes available to the current block may be determineddifferently based on the size of the current block. For example, if thecurrent block is of size 8×8, 16×16, or 32×32, there may be 34intra-prediction modes. If the current block is of size 4×4, there maybe 17 intra-prediction modes. The 34 or 17 intra-prediction modes mayinclude one or more non-directional modes and a plurality of directionalmodes. The one or more non-directional modes may be a DC mode and/or aplanar mode. If the DC mode and the planar mode correspond to thenon-directional modes, there may exist 35 intra-prediction modesirrespective of the size of the current block. In this case, the 35intra-prediction modes may include 2 non-directional modes (DC mode andplanar mode) and 33 directional modes.

In the planar mode, a prediction block of the current block is generatedusing at least one pixel value at a bottom-right position of the currentblock (or a prediction value of the pixel value, hereinafter referred toas a first reference value) and reference pixels.

The planar mode will be described below with reference to FIG. 3. FIG. 3is a drawing referred to for describing planar-mode prediction, when acurrent block is an 8×8 block.

Referring to FIG. 3, prediction pixels corresponding to pixels between afirst reference value D at the bottom-right corner of a current blockand a pixel value C adjacent to a pixel at the bottom-left corner of thecurrent block among left pixels adjacent to the current block, aregenerated using the first reference value D and the pixel value C.Similarly, prediction pixels corresponding to pixels between the firstreference value D and a pixel value B adjacent to a pixel at thetop-right corner of the current block among upward pixels adjacent tothe current block, are generated using the first reference value D andthe pixel value B. Linear combination may be used in generating theprediction pixels. If pixels are not arranged linearly, the predictionpixels may be generated through predetermined non-linear combination.

Then, the remaining prediction pixels are generated using the generatedprediction pixels (i.e. the pixels between the pixels C and D and thepixels between the pixels B and D) and pixels adjacent to the currentblock (i.e. pixels between the pixels A and B and pixels between thepixels A and C). These prediction pixels may be generated by linearlycombining two adjacent pixels above and to the left of the current blockand two adjacent pixels under and to the right of the current block. Thecombination is not necessarily linear. Rather, non-linear combinationmay be used, taking into account a pixel distribution. As the aboveexample, in the planar mode, the number of the reference pixels used forgenerating the prediction pixels may be determined differently based ona position of the prediction pixel.

In the above example, it may occur that left reference pixels of thecurrent block are available but upper reference pixels of the currentblock are not available. In this case, the upper reference pixels may begenerated using the first reference value or one of the left referencepixels. In other words, if only the left reference pixels are available,the upper reference pixels may be generated by copying a top referencepixel of the left reference pixels, and prediction pixels between pixelsB and D may be generated by using the first reference value and areference pixel nearest to the upper pixel.

Likewise, if the upper reference pixels of the current block areavailable but the left reference pixels are not available, the leftreference pixel may be generated by copying the most-left referencepixel of the upper reference pixels, and prediction pixels betweenpixels C and D may be generated by using the left reference pixel andthe first reference value.

Meanwhile, the first reference value or information indicating the firstreference value may be transmitted in a bit stream to the video decoder,or the video decoder may derive the first reference value withoutreceiving it or the information.

If the first reference value or the information indicating the firstreference value is transmitted to the video decoder, the number of bitsto be transmitted may be reduced by transmitting the difference betweenthe first reference value and a prediction value of the reference valuecalculated using at least one of adjacent pixels of the current block,which have been encoded and reconstructed. For this purpose, theprediction value of the first reference value may be one of (1) theaverage of reference pixels adjacent to the current block, (2) theaverage of the pixels A, B and C, and (3) the average between the pixelsB and C. Alternatively, the difference between the pixels A and C iscompared with the difference between the pixels A and B and the pixel (Bor C) representing a direction corresponding to the smaller differencemay be determined as the prediction value of the first reference value.

On the other hand, if the first reference value is derived from thevideo encoder and the video decoder, both the video encoder and thevideo decoder should be able to derive the same reference value. Forthis purpose, the video encoder may use the reference pixels A, B and Cto generate the first reference value. On the assumption that pixelvalues within a picture are smoothly changed, one of (1) the sum of thepixel C and the difference between the pixels B and A or the sum of thepixel B and the difference between the pixels C and A, i.e. (B+C−A) and(2) the average between the pixels B and C may be set as the firstreference value. In this case, an adjacent reference pixel of the pixelB and an adjacent reference pixel of the pixel C may be used, instead ofthe pixels B and C. Likewise, since the video encoder and decoder canreconstruct the same first reference value, the video encoder does notneed to transmit the first reference value or the information indicatingthe first reference value to the video decoder, thereby reducing thenumber of bits to be transmitted.

When the intra-prediction mode of the current block is determined, aprediction block is generated (S150). The prediction block is generatedusing the reference pixel (including the generated reference pixel) orby linearly combining them based on the intra-prediction mode of thecurrent block. In DC mode, the prediction block of the current block isgenerated using an average value of adjacent reference pixels to thecurrent block. The adjacent reference pixels may include an availablereference pixel and the generated reference pixel.

If the intra-prediction mode of the current block is determined,information indicating the intra-prediction mode is encoded (S160). Theintra-prediction mode information may be encoded in the intra-predictor120, a separately configured intra-prediction mode encoder (not shown),or the entropy encoder 150.

In the case where many reference blocks are adjacent to the currentblock, there may be a difference between reference pixels at theboundaries of the reference blocks. In this case, residual blocksgenerated after a prediction block is generated are highly likely tocontain many high-frequency components. Therefore, blocking artifactbetween the reference blocks affects the current block. This problemgets severe as the current block is larger in size. On the other hand,the problem may not occur if the reference blocks are larger than thecurrent block.

Accordingly, one of methods for solving the problem is to generate newreference pixels by adaptively filtering the reference pixels. Togenerate the new reference pixel may precede the determination of anintra-prediction mode. That is, the new reference pixels may begenerated in advance by adaptively filtering the reference pixels basedon the intra-prediction mode and the size of the prediction block, andthen the intra-prediction mode of the current block may be determinedusing original reference pixels and the new reference pixels.Alternatively, the method may be performed after the intra-predictionmode of the current block is determined. Since the problem related tothe blocking artifact gets severe as a block size is larger, the numberof the prediction mode for filtering the reference pixels may be equalto or increased.

If the available reference pixels need to be filtered, two or morefilters may be adaptively applied according to the difference betweenthe reference pixels. The filter is preferably low-band pass filter. Forexample, if two filters are used, first and second filters maycorresponds to a 3-tap filter and a 5-tap filter, respectively. Thesecond filter may be implemented by applying the first filter twice.Preferably, the filter coefficients of the filters are symmetrical. Or,only one filter may be used for reducing a complexity.

Preferably, the filter is adaptively used according to the size of thecurrent block (a block for which the intra-prediction will beperformed). That is, if the filter is used, it is preferred to apply afilter with a narrow bandwidth when the current block is smaller to asmall block and a filter with a broad bandwidth to a large block.However, if the size of the current block is smaller than the number oftaps of a filter, the filter is not applied to the current block.

In the DC mode, there is no need for applying a filter because aprediction block is generated using the average value of referencepixels. If a filter is used in the DC mode, a computation volume isunnecessarily increased. In addition, in case of a vertical mode inwhich an image is correlated vertically, there is no need for applying afilter to the reference pixel. Also, in case of a horizontal mode inwhich an image is correlated horizontally, there is no need for applyinga filter to the reference pixel. Because whether to apply a filter to acurrent block is associated with the intra-prediction mode of thecurrent block, the reference pixel may be adaptively filtered based onthe intra-prediction mode of the current block and a size of a block forwhich the intra-prediction will be performed. If the size of the blockfor which the intra-prediction will be performed is smaller than apredetermined size (for example, 4×4), the reference pixel is notfiltered. Or, even though the size of the block is larger than thepredetermined size, the reference pixel may be not filtered, forreducing a complexity. If the size of the block is included within arange of the predetermined size, when the reference pixel is filtered inany one mode of intra-prediction modes between a diagonalintra-prediction mode (a mode which has a difference of 45° angle fromhorizontal or vertical mode) and a horizontal intra-prediction mode, thereference pixel is filtered in directional modes between the mode andthe diagonal intra-prediction mode.

Another method for solving the above-described problem is to generate anew prediction block by adaptively filtering a portion of pixels withinthe prediction block that has been generated using the reference pixels.Neighboring prediction pixels adjacent to reference pixels, ofprediction pixels within a prediction block, according to theintra-prediction mode of the current block, may be amended using atleast one of the reference pixels. This method may also be applied whengenerating the prediction block.

For example, in case of DC mode, a neighboring prediction pixel adjacentto reference pixels, of prediction pixels within a prediction block, isfiltered using a reference pixel adjacent to the neighboring predictionpixel. Accordingly, the prediction pixel is filtered using one or tworeference pixels according to a position of the prediction pixel. Thefiltering of the prediction pixel in the DC mode may be applied forprediction blocks of all sizes.

In case of vertical mode, neighboring prediction pixels adjacent to leftreference pixels, of prediction pixels within a prediction block, may bechanged using reference pixels except for upper pixels used forgenerating the prediction block. Likewise, in case of horizontal mode,neighboring prediction pixels adjacent to upper reference pixels, ofgenerated prediction pixels, may be changed using reference pixelsexcept for left pixels used for generating the prediction block.

Meanwhile, a residual block between the current block and the predictionblock generated by the intra-predictor 120 is encoded through thetransform encoder/quantizer 140 and the entropy encoder 150.

The residual block is first transformed. For effective energycompression, a block size for transforming the residual block isdetermined and then the residual block is transformed in blocks each ofthe determined block size. Or the block size for transformation may bedetermined in advance. In this case, the block size for transformationmay be determined as a size of the current block for intra-prediction. Adifferent transformation scheme may be used according to anintra-prediction mode. For example, integer-based DCT (Discrete CosineTransform), in horizontal and vertical direction, may be applied to aresidual block intra-predicted in the DC mode and integer-based DST(Discrete Sine Transform), in horizontal and vertical direction, may beapplied to a residual block intra-predicted in the planar mode. It maybe applied to a block which has a size being equal to or smaller than apredetermined size. But, in case of a block for transformation which hasa size being larger than the predetermined size, the only integer-basedDCT may be applied, irrespective of the intra-prediction mode. DCT orDST, in horizontal and vertical direction, may be adaptively usedaccording to a prediction mode.

The transformed residual block is quantized. A different quantizationmatrix is used according to a size of the residual block. Also, forresidual blocks of the same size, different quantization matrices may beused. That is, the more effective quantization matrix of at least twoquantization matrices may be used based on the coefficient distributionof the transformed residual block. In this case, information indicatingthe used quantization matrix may be transmitted to the video decoder. Inaddition, a different quantization matrix may be applied to thetransformed residual block, based on an intra-prediction mode.

Then, the two-dimensional quantized coefficients are converted to asequence of one-dimensional quantized coefficients using one of aplurality of predetermined scan patterns and then entropy-encoded. Thescan pattern may be determined based on the intra-prediction mode, orbased on the intra-prediction mode and the block size for thetransformation.

FIG. 4 is a block diagram of a video decoder according to an embodimentof the present invention.

Referring to FIG. 4, the video decoder of the present invention includesan entropy decoder 210, a dequantizer/inverse transformer 220, anintra-predictor 230, a motion compensation predictor 240, a deblockingfilter 250, a picture storage 260, an adder 270, and an intra/interswitch 280.

The entropy decoder 210 separates a coded bit stream received from thevideo encoder into an intra-prediction mode index, motion information,and a quantized coefficient sequence by decoding the coded bit streamand provides the decoded motion information to the motion compensationpredictor 240, the intra-prediction mode index to the intra-predictor230 and the dequantizer/inverse transformer 220, and the quantizedcoefficient sequence to the dequantizer/inverse transformer 220.

The dequantizer/inverse transformer 220 converts the quantizedcoefficient sequence to a two-dimensional array of dequantizedcoefficients. For the conversion, one of a plurality of scan patterns isselected. One of the plurality of scan patterns is selected based on theprediction mode (i.e. one of intra-prediction and inter-prediction) ofthe current block, intra-prediction mode and a block size fortransformation. The intra-prediction mode is received from theintra-predictor 230 or the entropy decoder 210.

The dequantizer/inverse transformer 220 reconstructs quantizedcoefficients from the two-dimensional array of dequantized coefficientsusing a quantization matrix selected from among a plurality ofquantization matrices. The quantization matrix may be determined usinginformation received from an encoder. A different quantization matrixmay be used according to a size of the current block (block fortransformation) to be reconstructed. Even for blocks of the same size,the dequantizer/inverse transformer 220 may select a quantization matrixbased on at least one of the prediction mode of the current block andthe intra-prediction mode. Then a residual block is reconstructed byinversely transforming the reconstructed quantized coefficients.

The adder 270 adds the reconstructed residual block received from thedequantizer/inverse transformer 220 to a prediction block generated fromthe intra-predictor 230 or the motion compensation predictor 240,thereby reconstructing an image block.

The deblocking filter 250 performs a deblocking filtering for thereconstructed image obtained by the adder 270. Thus, deblocking artifactcaused by image loss during quantization may be reduced.

The picture storage 260 is a frame memory that preserves a local decodedimage that has been deblocking-filtered by the deblocking filter 250.

The intra-predictor 230 decodes the intra-prediction mode of the currentblock based on the intra-prediction mode index received from the entropydecoder 210 and generates a prediction block according to the decodedintra-prediction mode.

The motion compensation predictor 240 generates a prediction block ofthe current block from a picture stored in the picture storage 260 basedon the motion vector information. If the motion compensation with afractional-pixel accuracy is applied, the prediction block is generatedusing a selected interpolation filter.

The intra/inter switch 280 provides the prediction block generated fromone of the intra-predictor 230 and the motion compensation predictor 260to the adder 270.

Now a description will be given of an operation for reconstructing acurrent block through intra-prediction with reference to FIG. 4. FIG. 5is a flowchart illustrating an operation for reconstructing anintra-block according to an embodiment of the present invention.

The intra-prediction mode of a current block is decoded from a receivedbit stream (S310).

For this purpose, the entropy decoder 210 reconstructs a firstintra-prediction mode index referring to one of a plurality of tablesrelated to intra-prediction mode.

The plurality of tables related to the intra-prediction mode are sharedbetween the video encoder and the video decoder. One of the tablesrelated to the intra-prediction mode may be selected according to thedistribution of the intra-prediction modes of a plurality of blocksadjacent to the current block. For example, if the intra-prediction modeof a left block adjacent to the current block is identical to that of anupper block adjacent to the current block, the first intra-predictionmode index of the current block may be reconstructed using a firstintra-prediction mode table. If the intra-prediction modes of the leftand upper adjacent blocks are different, the first intra-prediction modeindex of the current block may be reconstructed using a secondintra-prediction mode table. In another example, in the case where theintra-prediction modes of both the left and upper adjacent blocks aredirectional intra-prediction modes, if the directions of theintra-prediction modes are within a predetermined angle, the firstintra-prediction mode index of the current block may be decoded usingthe first intra-prediction mode table. If the directions of theintra-prediction modes are outside the predetermined angle, the firstintra-prediction mode index of the current block may be decoded usingthe second intra-prediction mode table.

The entropy decoder 210 transmits the decoded first intra-predictionmode index of the current block to the intra-predictor 230. If the firstintra-prediction mode index is a minimum value (i.e. 0), theintra-predictor 230 determines a maximum mode available for the currentblock to be the intra-prediction mode of the current block. On the otherhand, if the first intra-prediction mode index is non-zero, theintra-predictor 230 compares a maximum mode index indicating the maximummode with the first intra-prediction mode index of the current block. Ifthe first intra-prediction mode index is equal to or larger than themaximum mode index, the intra-predictor 230 determines anintra-prediction mode corresponding to a second intra-prediction modeindex, which has a value of the first intra-prediction mode index plus1, to be the intra-prediction mode of the current block. Otherwise, theintra-predictor 230 determines an intra-prediction mode corresponding tothe first intra-prediction mode index to be the intra-prediction mode ofthe current block.

The intra-prediction mode available to the current block may include oneor more non-directional mode and a plurality of directional modes. Theone or more non-directional mode may be a DC mode and/or a planar mode.One of the DC mode and the planar mode may be included adaptively in anavailable intra-prediction mode set. Thus, information indicating anon-directional mode included in the available intra-prediction mode setmay be included in a picture header or a slice header.

Subsequently, the intra-predictor 230 reads reference pixels from thepicture storage 260 to generate an intra-prediction block and determineswhether there exists an unavailable reference pixel (S320). Thedetermination may be made based on whether there are reference pixelsneeded for generating an intra-prediction block according to theintra-prediction mode of the current block.

If it is necessary to generate reference pixels, the intra-predictor 230may generate reference pixels on unavailable position using decodedreference pixels (S325). The definition of the unavailable referencepixels and the methods for generating reference pixels have beendescribed in relation to the operation of the intra-predictor 120illustrated in FIG. 2. Only reference pixels required to generate anintra-prediction block according to the intra-prediction mode of thecurrent block may be selectively reconstructed.

The intra-predictor 230 determines whether to filter reference pixels togenerate the prediction block (S330). That is, the intra-predictor 230determines whether to perform a filtering for reference pixels, based onthe intra-prediction mode and the size of the current block, to generatethe intra-prediction block of the current block. Since the problem aboutblocking artifact gets severe as the current block is larger in size,the number of prediction mode for filtering a reference pixel can beincreased as the current block is larger in size. However, the referencepixel may not be filtered for decreasing the complexity, since the blockmay be considered as an area in which pixels are smoothly changed whenthe block is larger than a predetermined value in size.

If determining to filter the reference pixels, the intra-predictor 230filters the reference pixels using a filter (S335).

If the valid reference pixels need to be filtered, it can adaptivelyapply at least two filters based on a difference of pixel values betweenthe reference pixels. Preferably, the filter coefficients of the filtersare symmetrical.

Preferably, the two or more filters may be adaptively used based on thesize of the current block. That is, when filters are used, it can applya filter with a narrow bandwidth to a small block and a filter with abroad bandwidth to a large block.

In the DC mode, there is no need for applying a filter in the DC modebecause a prediction block is generated using the average of referencepixels. That is, the amount of calculation may be increasedunnecessarily if the filter is applied. In addition, in case of avertical mode having a correlation vertically, the filter may not beneeded to apply for reference pixels. And, in case of a horizontal modehaving a correlation horizontally, the filter may not be needed to applyfor reference pixels. Because whether to apply a filter to a currentblock is related to the intra-prediction mode of the current block,adaptive filtering may be performed based on the intra-prediction modeof the current block and a block size of the prediction block.

Subsequently, a prediction block is generated using the reference pixelsor the filtered reference pixels according to the determinedintra-prediction mode (S340).

The generating method of the prediction block is omitted because theoperation of the encoder in FIG. 2 is similar to that. And, in case ofthe planar mode, the generating method of the prediction block is alsoomitted because the operation of the encoder in FIG. 2 is similar tothat. It is determined whether the generated prediction block is to befiltered (S350). The determination may be made based on informationincluded in a slice header or a CU header. Also, the determination maybe made based on the intra-prediction mode of the current block.

When it is determined to filter the generated prediction block, thegenerated prediction block is filtered (S335). Specifically, a new pixelis generated by filtering a pixel at a specific position in theprediction block that has been generated using available referencepixels adjacent to the current block. This method may also be appliedwhen generating the prediction block. For example, prediction pixelsadjacent to reference pixels in DC mode may be filtered using thereference pixels. Accordingly, the prediction pixels may be filteredusing one or two reference pixels based on a position of the predictionpixel. The filtering of prediction pixels in the DC mode may be appliedfor all sizes of a prediction block. In case of vertical mode,neighboring prediction pixels adjacent to left reference pixels, ofprediction pixels within a prediction block, may be changed usingreference pixels except for upper pixels used for generating theprediction block. Likewise, in case of horizontal mode, neighboringprediction pixels adjacent to upper reference pixels, of generatedprediction pixels, may be changed using reference pixels except for leftpixels used for generating the prediction block.

The current block is reconstructed using the reconstructed predictionblock of the current block and the decoded residual block of the currentblock.

It will be apparent to those skilled in the art that variousmodifications and variations can be made in the present inventionwithout departing from the spirit or scope of the invention. Thus, it isintended that the present invention cover the modifications andvariations of this invention provided they come within the scope of theappended claims and their equivalents.

What is claimed is:
 1. A method for encoding an image, the methodcomprising: determining an intra prediction mode of a current block;generating a prediction block of the current block according to theintra prediction mode; generating a residual block by calculating adifference between the current block and the prediction block;transforming the residual block to generate a transform block;quantizing the transform block to generate a quantized block; andentropy-coding coefficients of the quantized block, wherein thegenerating the prediction block of the current block according to theintra prediction mode includes: generating reference pixels on anunavailable position if there exist unavailable reference pixels of thecurrent block based on the intra prediction mode; determining whetherreference pixels of the current block are filtered or not based on theintra prediction mode and a block size of the current block; andfiltering the reference pixels of the current block using a filter if itis determined that the reference pixels of the current block arefiltered, wherein the reference pixels are adaptively filtered based onthe block size of the current block, wherein the filter is not appliedif it is determined that the size of the current block is smaller than afirst size, wherein if a number of intra prediction modes to which thefilter is applied is increased, it is determined that the size of thecurrent block is larger than the first size and smaller than a secondsize, wherein the filter is not applied to the intra prediction modecorresponding to a DC mode because the prediction block is generatedusing an average of the reference pixels, and wherein the intraprediction mode is selected among a predetermined number of directionalintra prediction modes and two non-directional intra prediction modes.2. The method of claim 1, wherein the two non-directional intraprediction modes are the DC mode and a planar mode.
 3. The method ofclaim 1, wherein if the selected intra prediction mode is a verticalmode, prediction pixels of the prediction block are changed usingreference pixels other than upper pixels used for generating theprediction block.
 4. The method of claim 1, wherein if the selectedintra prediction mode is a horizontal mode, prediction pixels of theprediction block are changed using reference pixels other than leftpixels used for generating the prediction block.
 5. A non-transitoryrecording medium which includes a bit stream decoded by an imagedecoding device, the bit stream being generated by dividing an imageinto a plurality of blocks and by performing intra prediction for acorresponding block and including: information indicating an intraprediction mode group indicator and a prediction mode index of a currentprediction block, and information indicating one-dimensional (1D)quantized transform coefficients generated by scanning quantizedtransform coefficients of a quantized transform block, wherein the imagedecoding device: restores the intra prediction mode group indicator andthe prediction mode index of the current prediction block and the 1Dquantized transform coefficients from the bit stream, generates thequantized transform block by inversely scanning the 1D quantizedtransform coefficients, generates a transform block by inverselyquantizing the quantized transform block, generates a residual block byinversely transforming the transform block, generates a prediction blockof the current prediction block according to an intra prediction mode,and generates an original block by adding the prediction block and theresidual block, wherein the image decoding device generates theprediction block by performing: generating reference pixels on anunavailable position if there exist unavailable reference pixels of thecurrent block; determining whether reference pixels of the current blockare filtered or not based on the intra prediction mode and a block sizeof the current block; filtering the reference pixels of the currentblock using a filter if it is determined that the reference pixels ofthe current block are filtered, wherein the reference pixels areadaptively filtered based on the block size of the current block,wherein the filter is not applied if it is determined that the size ofthe current block is smaller than a first size, wherein if a number ofintra prediction modes to which the filter is applied is increased, itis determined that the size of the current block is larger than thefirst size and smaller than a second size, wherein the filter is notapplied to the intra prediction mode corresponding to a DC mode becausethe prediction block is generated using an average of the referencepixels, and wherein the intra prediction mode is selected among apredetermined number of directional intra prediction modes and twonon-directional intra prediction modes.